<?php
/**
 * 客户订单发货物流
 * (model)
 */

namespace App\Models\CustomerDelivery;


use App\Models\Basics\ExpressChannel;
use App\Models\Basics\ExpressCompany;
use Illuminate\Database\Eloquent\Model;

class CustomerDeliveryLogistics extends Model{

    protected $table = 'customer_delivery_logistics';

    protected $guarded  = [];

    /**
     * 关联发货单
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function delivery(){
        return $this->belongsTo(CustomerDelivery::class, 'delivery_no', 'delivery_no');
    }

    /**
     * 关联物流公司
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function express_company(){
        return $this->belongsTo(ExpressCompany::class, 'express_company_id');
    }

    /**
     * 关联物流渠道/方式
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function express_channel(){
        return $this->belongsTo(ExpressChannel::class, 'express_channel_id');
    }

}
